home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
mebbs
/
nimrod.lha
/
NIMROD
/
NimRod.REXX
< prev
Wrap
OS/2 REXX Batch file
|
1994-05-30
|
8KB
|
253 lines
/* NimRod v1.0 original by D.F. Duck 29-Mar-90 */
/* Converted for Starnet use by Allan Antoszewski 16-Nov-91 */
/* re-written and improved by */
/* Robert Lehman of Southwinds bbs for mebbsnet >1.5x */
/* May 30th 1994, (219) 289-3275 Vfast 28.8 Maxnet International 90:91/0 */
/* Mebbs developers #M3005 */
SIGNAL ON ERROR
SIGNAL ON SYNTAX
SIGNAL ON IOERR
SIGNAL ON FAILURE
parse arg LineNumber
OPTIONS RESULTS
DoorName = "Nimrod"
if( ~show( 'l', "mebbsarexx.library" ) )then do
if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
say "Could not open library"
exit 10
end
end
M=0
E=0
version = 'Version 2.0'
call getvar doorname,linenumber,8
gfx = result
if gfx = 1 then do
CLS = 'H'
HOM = ''
RED = '
'
YLW = '
'
GRN = '
'
CYN = '
'
MAG = '
'
BLU = '
'
GCN = '
'
RES = ''
BCK1= '26H'
end
else do
CLS = 'H'
HOM = ''
RED = ''
YLW = ''
GRN = ''
CYN = ''
MAG = ''
BLU = ''
GCN = ''
RES = ''
BCK1= ''
end
call message doorname,linenumber, CLS,1
call message doorname,linenumber, ' ',1
Call prompt doorname,linenumber, CYN' Do you need instructions (Y/N)? ',2
Inst=upper(result)
if Inst='Y' then do
call Docs
call checkca
end
call message doorname,linenumber, CLS GRN' ___',1
call message doorname,linenumber, ' /| / /_/',1
call message doorname,linenumber, ' _/ |/'RES'IM'GRN'/ |'RES'OD'MAG' Converted for'GRN' Mebbsnet use'MAG' by'CYN' Robert Lehman',1
call message doorname,linenumber, MAG' SouthWinds bbs'GRN' (219)-289-3275',1
call message doorname,linenumber, BLU' 'Version,1
call message doorname,linenumber, ' ',1
call message doorname,linenumber, MAG' Based on the original by 'RED'D.F. Duck'RES,1
MakeNum:
Z=RANDOM(1,8,Time(s))
Z=(16+Z)%1
if 2*(Z/2)=Z then Z=Z+1
call HowMany
return
HowMany:
H=RANDOM(1,3,Time(s))
H=(2+H)%1
if H>Z then H=Z
call NimS
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'H'YLW' There are now 'GRN''Z' 'YLW'Nims ',1
call message doorname,linenumber, ' Maximum to take 'BLU''H,1
call message doorname,linenumber, ' ',1
call Take
return
Take:
Call prompt doorname,linenumber, 'H'CYN' How many will you take? 'RES BCK1,1
E=upper(result)
if E<1 | E>H then call Take
if E='Q' then signal die
Z=Z-E
if Z<1 then call Lost
call checkca
call NimS
call message doorname,linenumber, 'H'YLW' There are now 'GRN''Z' 'YLW'Nims ',1
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'H'MAG' You took 'YLW''E,1
call Math
call Delay
call message doorname,linenumber, 'H'BLU' NimRod takes 'RED''Q,1
call Delay
Z=Z-Q
if Z=0 then call Won
call HowMany
return
Delay:
do x = 1 to 300
end
return
Math: /* This is how many NimRod takes each turn */
Q=RANDOM(1,5,Time(s))
if Q>Z | Q>H then call Math
if Z=2 then Q=1 /* Give NimRod a little smarts anyway... */
if Z=3 then Q=2 /* otherwise it`s too easy to always win */
if Z=4 & H>2 then Q=3
if Z=5 & H>3 then Q=4
if Z=6 & H>4 then Q=5
if Z=7 then Q=1
if Z=8 then Q=2
if Z=9 & H>2 then Q=3
return
NimS:
If Z=24 then NS=' O O O O O O O O O O O O O O O O O O O O O O O O'
If Z=23 then NS=' O O O O O O O O O O O O O O O O O O O O O O O '
If Z=22 then NS=' O O O O O O O O O O O O O O O O O O O O O O '
If Z=21 then NS=' O O O O O O O O O O O O O O O O O O O O O '
If Z=20 then NS=' O O O O O O O O O O O O O O O O O O O O '
If Z=19 then NS=' O O O O O O O O O O O O O O O O O O O '
If Z=18 then NS=' O O O O O O O O O O O O O O O O O O '
If Z=17 then NS=' O O O O O O O O O O O O O O O O O '
If Z=16 then NS=' O O O O O O O O O O O O O O O O '
If Z=15 then NS=' O O O O O O O O O O O O O O O '
if Z=14 then NS=' O O O O O O O O O O O O O O '
If Z=13 then NS=' O O O O O O O O O O O O O '
If Z=12 then NS=' O O O O O O O O O O O O '
If Z=11 then NS=' O O O O O O O O O O O '
if Z=10 then NS=' O O O O O O O O O O '
If Z=9 then NS=' O O O O O O O O O '
If Z=8 then NS=' O O O O O O O O '
If Z=7 then NS=' O O O O O O O '
If Z=6 then NS=' O O O O O O '
If Z=5 then NS=' O O O O O '
If Z=4 then NS=' O O O O '
If Z=3 then NS=' O O O '
If Z=2 then NS=' O O '
If Z=1 then NS=' O '
call message doorname,linenumber, 'H'RED' 'NS RES,1
return
Lost:
call message doorname,linenumber, 'H ',1 /* clear remaining Nims */
call message doorname,linenumber, RED'H You took the last one, so NimRod wins!!',1
call Again
return
Won:
call message doorname,linenumber, 'H ',1
call message doorname,linenumber, GRN'H NimRod took the last 'Q' so YOU WIN!!'RES,1
call Again
return
Again:
Call prompt doorname,linenumber, YLW' Play NimRod again (Y/N)? > 'RES,2
over=upper(result)
if over=' ' | over='N' | over='n' then signal Die
if over='Y' then do
call checkca
call message doorname,linenumber, '11H ',1
call message doorname,linenumber, '15H ',1
call message doorname,linenumber, 'H ',1
call message doorname,linenumber, ' ',1
end
call MakeNum
return
Docs:
call message doorname,linenumber, CLS,1
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'NimRod displays an odd number of objects, tells you how many you can take,',1
call message doorname,linenumber, 'then takes a few itself. This fascinating process continues until there is',1
call message doorname,linenumber, 'only one left. At this point the player who must take the last one loses.',1
call message doorname,linenumber, ' ',1
call message doorname,linenumber, RES' O'YLW'< 'GRN'Have Funn!',1
call message doorname,linenumber, RES' *===',1
call message doorname,linenumber, YLW' ^'RES,1
call message doorname,linenumber, ' ',1
Call hotkey doorname,linenumber, 'Press RETURN'
call checkca
return
/* Procedures */
CHECKCA:
call cdetect doorname,linenumber
carrier = result
if carrier = "no carrier!" then signal die
return
IOERR:
call message doorname,linenumber,"",1
Call message doorname,linenumber, '**ALERT** input output error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
ERROR:
call message doorname,linenumber,"",1
Call message doorname,linenumber, '**ALERT** General Error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
SYNTAX:
Call message doorname,linenumber, '**ALERT** Syntax Error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
FAILURE:
Call message doorname,linenumber, '**ALERT** Failure!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
Die:
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'Exiting...',1
call exit_door DoorName,LineNumber
exit 0